package com.tj.collection.db.service;

import com.fqgj.common.api.Page;
import com.tj.collection.db.domain.AdminVo;
import com.tj.collection.db.domain.Role;
import com.tj.collection.db.enums.RoleKeyEnum;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/3/14
 * Time: 下午1:17
 */
public interface AdminRoleService {

    /**
     * @param role
     * @return
     */
    Boolean add(Role role);

    Boolean addRoleAndMenu(Role role, List<Long> menuIds);

    /**
     * 角色菜单同步
     * 只同步通用菜单
     *
     * @param roleKey
     * @param sourceMerchantCode
     * @param targetMerchantCode
     * @return
     */
    Boolean syncRoleAndMenu(String roleKey, String sourceMerchantCode, String targetMerchantCode);

    /**
     * @param roleName
     * @param page
     * @return
     */
    List<Role> searchRoleList(String roleName, Page page, String merchantCode);

    /**
     * @param role
     * @return
     */
    Boolean update(Role role);


    /**
     * @param adminId
     * @return
     */
    List<Long> getRoleIdsByAdminId(Long adminId);

    /**
     * 根据管理员ID获取管理员角色
     *
     * @param adminId
     * @return
     */
    List<Role> getRolesByAdminId(Long adminId);

    /**
     * 全量更新角色 先删后插
     *
     * @param adminId
     * @param roleIds
     * @return
     */
    Boolean addRoleToAdmin(Long adminId, List<Long> roleIds);

    /**
     * 添加一个角色
     *
     * @param adminId
     * @param roleId
     * @return
     */
    Boolean addOneRoleToAdmin(Long adminId, Long roleId);

    /**
     * 获取信审人员的角色id
     *
     * @return
     */
    Long getRoleIdForAuditor(RoleKeyEnum roleKeyEnum, String merchantCode);

    Long getRoleIdByRoleKey(RoleKeyEnum roleKeyEnum, String merchantCode);

    List<Long> getRoleIdByRoleKeyList(List<RoleKeyEnum> roleKeyEnumList, String merchantCode);

    /**
     * 判断是否存在指定角色
     *
     * @param adminId
     * @param roleKeyEnum
     * @param merchantCode
     * @return
     */
    boolean isContainsRoleKey(Long adminId, RoleKeyEnum roleKeyEnum, String merchantCode);

    /**
     * 获取超级管理员的角色id
     *
     * @return
     */
    Long getRoleIdForSuperAdmin(String merchantCode);

    /**
     * 获取超级管理员和信审经理角色ID
     *
     * @return
     */
    List<Long> getSuperAndAuditManagerRoleIds(String merchantCode);

    /**
     * @param roleId 角色ID
     * @return
     */
    List<Long> getAdminIdListByRoleId(Long roleId);

    /**
     * @param roleIdList
     * @return
     */
    List<Long> getAdminIdListByRoleIdList(List<Long> roleIdList);

    /**
     * 校验管理员的角色
     *
     * @param adminId 管理员
     * @param roleId  角色id
     * @return
     */
    Boolean checkAdminRole(Long adminId, List<Long> roleId);
}
